public class Test17 {
    static int[] a = {1, 2, 3, 4, 5, 6, 7, 8};

    //使用递归进行打印
    public static void main(String[] args) {
        dfs(a, 0);
    }

    public static void dfs(int[] a, int i) {
        //递归终止条件
        if (i == a.length)
            return;
        //1.
        System.out.print(a[i] + " ");
        //2.
        dfs(a, i + 1);
    }
}
